package com.xxwy.ddu.security.code.authentication.qq.connection;

import com.xxwy.ddu.security.code.authentication.qq.QQ;
import com.xxwy.ddu.security.code.authentication.qq.impl.QQImpl;
import org.springframework.social.oauth2.AbstractOAuth2ServiceProvider;

/**
 * @author xxwy
 * on 2018/8/23 0023
 */
public class QQServiceProvide extends AbstractOAuth2ServiceProvider<QQ> {

    private String appid;
    //获取授权码
    private static final String URL_AUTHORIZE = "https://graph.qq.com/oauth2.0/authorize";
    //获取Access Token
    private static final String URL_ACCESSTOKEN = "https://graph.qq.com/oauth2.0/token";

    public QQServiceProvide(String appid,String appSecret) {
        super(new QQOAuth2Template(appid,appSecret,URL_AUTHORIZE,URL_ACCESSTOKEN));
        this.appid = appid;

    }

    @Override
    public QQ getApi(String s) {
        return new QQImpl(s,appid);
    }
}
